
*********************
clear all

* PLACEBO USING STARBUCKS * 

cd "/Users/mariadelmarcanizaresespadafor/Dropbox/Side projects/BET HOUSES PROJECT/data/Gambling_Replication_Materials/Data"
*cd "~/Dropbox/EUI/BET HOUSES PROJECT/data/Gambling_Replication_Materials/Data/"

use "gambling_data.dta", clear

* Changing directory to estimates folder:
cd "/Users/mariadelmarcanizaresespadafor/Dropbox/Side projects/BET HOUSES PROJECT/data/Gambling_Replication_Materials/Estimates"
*cd "~/Dropbox/EUI/BET HOUSES PROJECT/data/Gambling_Replication_Materials/Estimates/"

*********************

xtreg pau treat i.year, fe
regsave treat using "star1.dta", tstat pval ci level(90) replace addlabel (Income, All, School, All, Var, bin, Level, 90)
xtreg pau treat i.year, fe
regsave treat using "star1.dta", tstat pval ci level(95) append addlabel (Income, All, School, All, Var, bin, Level, 95)

xtreg pau treat i.year if renta2==0, fe
regsave treat using "star1.dta", tstat pval ci level(90) append addlabel (Income, poor, School, All, Var, bin, Level, 90)
xtreg pau treat i.year if renta2==0, fe
regsave treat using "star1.dta", tstat pval ci level(95) append addlabel (Income, poor, School, All, Var, bin, Level, 95)

xtreg pau treat i.year if renta2==1, fe
regsave treat using "star1.dta", tstat pval ci level(90) append addlabel (Income, rich, School, All, Var, bin, Level, 90)
xtreg pau treat i.year if renta2==1, fe
regsave treat using "star1.dta", tstat pval ci level(95) append addlabel (Income, rich, School, All, Var, bin, Level, 95)


xtreg pau logdist_year_star i.year, fe
regsave logdist_year_star using "star1.dta", tstat pval ci level(90) append addlabel (Income, All, School, All, Var, cont, Level, 90)
xtreg pau logdist_year_star i.year, fe
regsave logdist_year_star using "star1.dta", tstat pval ci level(95) append addlabel (Income, All, School, All, Var, cont, Level, 95)

xtreg pau logdist_year_star i.year if renta2==0, fe
regsave logdist_year_star using "star1.dta", tstat pval ci level(90) append addlabel (Income, poor, School, All, Var, cont, Level, 90)
xtreg pau logdist_year_star i.year if renta2==0, fe
regsave logdist_year_star using "star1.dta", tstat pval ci level(95) append addlabel (Income, poor, School, All, Var, cont, Level, 95)

xtreg pau logdist_year_star i.year if renta2==1, fe
regsave logdist_year_star using "star1.dta", tstat pval ci level(90) append addlabel (Income, rich, School, All, Var, cont, Level, 90)
xtreg pau logdist_year_star i.year if renta2==1, fe
regsave logdist_year_star using "star1.dta", tstat pval ci level(95) append addlabel (Income, rich, School, All, Var, cont, Level, 95)

use "star1.dta"

gen ci_lower95=ci_lower if Level==95
gen ci_upper95=ci_upper if Level==95

gen ci_lower90=ci_lower if Level==90
gen ci_upper90=ci_upper if Level==90

gen id2=0 if Income=="All"
replace id2=1 if Income=="poor"
replace id2=2 if Income=="rich"

gen variable=1 if Var=="cont"
replace variable=0 if Var=="bin"

save "star1.dta", replace
